<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="" >

    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Businesstype')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">

            <select  id="c-businesstype" data-rule="" class="form-control selectpicker select-spec" name="row[businesstype]">
                <option value=""></option>
                {foreach name="businesstypeList" item="vo"}
                <option value="{$key}">{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Taobaoname')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <input id="c-taobaoname" data-rule="required" autocomplete="off" class="form-control add-spec" name="row[taobaoname]" type="text" value="">
        </div>
    </div>
    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Idnumber')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <input id="c-idnumber" data-rule="IDcard" autocomplete="off" class="form-control add-spec" name="row[idnumber]" type="text" value="">
        </div>
    </div>
    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('客户姓名')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <input id="c-name" data-rule="" autocomplete="off" class="form-control add-spec" name="row[name]" type="text" value="">
        </div>
    </div>
    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('客户电话')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <input id="c-mobile" data-rule="" autocomplete="off" class="form-control add-spec" name="row[mobile]" type="text" value="">
        </div>
    </div>

    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Paymentnumber')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <input id="c-paymentnumber" data-rule="" autocomplete="off" class="form-control add-spec" name="row[paymentnumber]" type="text" value="">
        </div>
    </div>

    <div class="form-group select-spec">
        <label for="c-payingcompany" class="control-label col-xs-12 col-sm-2 add-spec">{:__('Payingcompany')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">

            <select id="c-payingcompany" data-rule="" class="form-control selectpicker select-spec" name="row[payingcompany]">
                <option data-type="0" value="0" disabled>{:__('None')}</option>
            </select>

        </div>
    </div>

    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Paymentbase')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <input id="c-paymentbase" data-rule="" class="form-control add-spec" name="row[paymentbase]" type="number" value="0">
        </div>
    </div>
    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Paymentamount')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <input id="c-paymentamount" data-rule="" class="form-control add-spec" name="row[paymentamount]" type="number" value="0">
        </div>
    </div>

    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 select-spec">{:__('Paymentdate')}:</label>
        <div class="col-xs-4 col-sm-2 select-spec">
            <input id="c-paymentdate" data-rule="" class="form-control datetimepicker" data-date-format="YYYY-MM" data-use-current="true" name="row[paymentdate]" style="font-size: 20px;" type="text" value="{:date('Y-m')}">
        </div>
        <label class="control-label col-xs-12 col-sm-2 select-spec">至</label>
        <div class="col-xs-4 col-sm-2 select-spec">
            <input id="c-paymentdate2" data-rule="" class="form-control datetimepicker" data-date-format="YYYY-MM" data-use-current="true" name="row[paymentdate2]" style="font-size: 20px;" type="text" value="{:date('Y-m')}">
        </div>
    </div>

    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Agencyfees')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <textarea id="c-agencyfees" autocomplete="off" style="font-size:20px" class="form-control " rows="1" name="row[agencyfees]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group select-spec">
        <label class="control-label col-xs-12 col-sm-2 add-spec">{:__('Ordercomment')}:</label>
        <div class="col-xs-12 col-sm-8 add-spec">
            <textarea id="c-ordercomment" autocomplete="off" class="form-control " rows="1" name="row[ordercomment]" cols="50"></textarea>
        </div>
    </div>

    <div class="form-group select-spec">
        <label class="control-label col-xs-6 col-sm-2 add-spec">{:__('Newkehu')}:</label>
        <div class="col-xs-6 col-sm-1 add-spec">
            <input id="c-newkehu" class="add-spec" type="checkbox" name="row[newkehu]" value="是" style="height: 35px;margin-top: -1px; margin-bottom: 1px; vertical-align: middle;">
        </div>
        <label class="control-label col-xs-6 col-sm-2 add-spec">{:__('Preprocessing')}:</label>
        <div class="col-xs-6 col-sm-1 add-spec">
            <input id="c-preprocessing" class="add-spec" type="checkbox" name="row[preprocessing]" value="是" style="height: 35px;margin-top: -1px; margin-bottom: 1px; vertical-align: middle;">
        </div>

        <label class="control-label col-xs-6 col-sm-2 add-spec">强制添加:</label>
        <div class="col-xs-6 col-sm-1 add-spec">
            <input id="c-qztj" class="add-spec" type="checkbox" name="row[qztj]" value="是" style="height: 35px;margin-top: -1px; margin-bottom: 1px; vertical-align: middle;">
        </div>
    </div>


    <label id="c-laokehutishi" class="control-label col-xs-6 col-sm-10" style="color:red;"></label>
    <input id="c-laokehu" type="hidden" value="">

    <input id="c-businesstype0" type="hidden" value="">
    <input id="c-payingcompany0" type="hidden" value="">
    <input style="display:none;">

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-4 add-spec"></label>
        <div class="col-xs-12 col-sm-3 add-spec">
            <!--<button id="c-submit" type="submit" class="btn btn-success btn-embossed disabled" onclick = 'submit2();'>{:__('保存')}</button>-->
            <button id="c-submit" type="button" class="btn btn-success btn-embossed" style="width: 200px" >{:__('保存')}</button>
        </div>
        <button id="c-close" type="button" class="btn btn-success btn-embossed">{:__('关闭')}</button>

    </div>
</form>


<script>
    var cdata = {
        companyList: {:json_encode(array_values($companyList))},
        businesstypeList: {:json_encode(array_values($businesstypeList))},
    };

    function submit2(){
        var name = document.getElementById("c-taobaoname").value;
        if (name == null || name == '') {
            Backend.api.toastr.error("淘宝名称不能为空");
            return false;
        }
        name = document.getElementById("c-idnumber").value;
        if (name == null || name == '') {
            Backend.api.toastr.error("身份证号不能为空");
            return false;
        }
        name = document.getElementById("c-paymentnumber").value;
        if (name == null || name == '') {
            Backend.api.toastr.error("缴纳号码不能为空");
            return false;
        }
//        document.getElementById("add-form").submit();
        $("#add-form").ajaxSubmit(function(result) {
            // 对于表单提交成功后处理，result为表单正常提交后返回的内容
            console.log(result);
            if (result.status === true) {
                Backend.api.toastr.error(result.msg);
            } else {
                Backend.api.toastr.error(result.msg);
            }
        })

        return false;

    }


</script>
